using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_ph_ooMap : EntityTypeConfiguration<so_ph_oo>
    {
        public so_ph_ooMap()
        {
            // Primary Key
            this.HasKey(t => new { t.ORDER__, t.SUMFIELDS, t.DimFIELDS });

            // Properties
            this.Property(t => t.ITEM)
                .HasMaxLength(10);

            this.Property(t => t.ORDER__)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.SUMFIELDS)
                .IsRequired()
                .HasMaxLength(20);

            this.Property(t => t.DimFIELDS)
                .IsRequired()
                .HasMaxLength(6);

            // Table & Column Mappings
            this.ToTable("so_ph_oo");
            this.Property(t => t.ITEM).HasColumnName("ITEM");
            this.Property(t => t.ORDER__).HasColumnName("ORDER_#");
            this.Property(t => t.On_Order).HasColumnName("On_Order");
            this.Property(t => t.SUMFIELDS).HasColumnName("SUMFIELDS");
            this.Property(t => t.DimFIELDS).HasColumnName("DimFIELDS");
        }
    }
}
